Skip to content

Conversation

@Patrick-Pimentel-Bitwarden
Copy link
Contributor

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden commented Dec 9, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-27084

📔 Objective

  1. Update register to use new data types
  2. Added comments so that future removal of old properties is clear
  3. Made accounts controller not permit nullish ambiguity
  4. Added tests to demonstrate payloads result in same outcomes for the user model

📸 Screenshots

Screen.Recording.2025-12-11.at.5.21.28.PM.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 67.59777% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.91%. Comparing base (b9d1a35) to head (6301dbf).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
...Api/Request/Accounts/RegisterFinishRequestModel.cs 60.81% 46 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6715      +/-   ##
==========================================
+ Coverage   55.72%   59.91%   +4.18%     
==========================================
  Files        1949     1965      +16     
  Lines       86539    87037     +498     
  Branches     7725     7765      +40     
==========================================
+ Hits        48227    52150    +3923     
+ Misses      36506    32993    -3513     
- Partials     1806     1894      +88     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

Logo
Checkmarx One – Scan Summary & Detailsee51d20b-5446-44ea-82b5-09f29cdd4942

New Issues (1)

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM Use_Of_Hardcoded_Password /util/Seeder/Factories/UserSeeder.cs: 16
detailsThe application uses the hard-coded password MasterPassword for authentication purposes, either using it to verify users' identities, or to access...
Attack Vector
Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM Use_Of_Hardcoded_Password /util/Seeder/Factories/UserSeeder.cs: 62

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden marked this pull request as ready for review December 11, 2025 22:34
@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden requested a review from a team as a code owner December 11, 2025 22:34
@Patrick-Pimentel-Bitwarden
Copy link
Contributor Author

Adding @eligrubb to review because he has work he is branching off of this to do!

@claude
Copy link
Contributor

claude bot commented Dec 11, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden removed the ai-review Request a Claude code review label Jan 2, 2026
@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden marked this pull request as ready for review January 2, 2026 18:23
IdentityResult? identityResult = null;

// PM-28143 - Just use the MasterPasswordAuthenticationData.MasterPasswordAuthenticationHash
string masterPasswordHash = model.MasterPasswordAuthentication?.MasterPasswordAuthenticationHash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename to "masterPasswordAuthenticationHash", or just use the MasterPasswordAuthentication struct all the way through. Even if it is not on the request model, you can still construct it from the email and kdf that are on the request model.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed with 93c9631

Copy link
Contributor Author

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I want to reconstruct it right now in the interest of trying to keep things simpler. Is that okay with you to just do the rename?

As an aside, would you mind pointing me to where I would look to see an example of how to reconstruct it in the server so I can learn?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable.

What I meant by reconstruction is that the authentication data is just the "MasterPasswordHash", KDF, salt (lower-cased and trimmed email) packed into a struct. You can just directly make it with something like:

MasterPasswordAuthenticationData
        {
            Kdf = Kdf {...}
            MasterPasswordAuthenticationHash = MasterPasswordHash,
            Salt = email.toLower().trim()
        };

Comment on lines 243 to 244
// Always force a valid encrypted string for tests to avoid model validation failures.
var masterKeyWrappedUserKey = DefaultEncryptedString;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This doesn't sound correct, to override all of the test's user key, just because the tests themselves have invalid encrypted string.
This requires fixing the tests that use this function.

Copy link
Contributor Author

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree it shouldn't override. However the tests will be addressed in PM-28143 and will have to be updated to use the new data types then.

mzieniukbw
mzieniukbw previously approved these changes Jan 13, 2026
@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden merged commit 8cb8030 into main Jan 15, 2026
84 of 89 checks passed
@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden deleted the auth/pm-27084/register-accepts-new-data-types branch January 15, 2026 20:55
@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden restored the auth/pm-27084/register-accepts-new-data-types branch January 15, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants